package com.czxy.Demo21;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        //  创建员工集合
        List<Employee> list = new ArrayList<>();
        list.add(new Employee("柳岩" , 2100));
        list.add(new Employee("张亮" , 1700));
        list.add(new Employee("诸葛亮" , 1800));
        list.add(new Employee("灭绝师太" , 2600));
        list.add(new Employee("东方不败" , 3800));

        //  存放到map集合中
        Map<String , Integer> map = new HashMap<>();
        for (Employee employee : list) {
            if(employee.getName().equals("柳岩")){
                employee.setGz(employee.getGz()+300);
            }
            map.put(employee.getName(),employee.getGz());
        }

        //  迭代遍历map集合
        Set<Map.Entry<String , Integer>> entry = map.entrySet();
        for (Map.Entry<String, Integer> stringIntegerEntry : entry) {
            System.out.println(stringIntegerEntry.getKey()+"\t"+stringIntegerEntry.getValue());
        }
    }
}